package com.yunchi.utils;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;

/**
 * @Author: Crazer
 * @Date: 2023/7/4 10:16
 * @version: 1.0.0
 * @Description:
 */
public class FileUtils {

    /**
     * 以字符串形式读取文件
     *
     * @param filePath
     * @return
     * @throws IOException
     */
    public static String readFileAsString(String filePath) throws IOException {
        byte[] encodedBytes = Files.readAllBytes(Paths.get(filePath));
        return new String(encodedBytes, StandardCharsets.UTF_8);
    }
}
